package com.cedric.yixianpai.game.cards.Sects.swordCards.b_ZhuJi;

import com.cedric.yixianpai.game.Constants.Period;
import com.cedric.yixianpai.game.Status.DuelStatus;
import com.cedric.yixianpai.game.interfaces.SwordCard;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class DiShaJian extends SwordCard {
    /**
     * 地煞剑 -1SE
     * 8/11/14
     * 每击伤一点生命加一防
     */
    public DiShaJian(@Value("1") int lvl) {
        super("地煞剑");
        this.setLevel(lvl);
        this.setPeriod(Period.ZHUJI);
        this.setDescription("灵气-1 8/11/14攻 每击伤一点生命加一防");
        this.setSpiritNeed(1);
        if (1 == lvl) {
            this.setDamage(8);
        } else if (2 == lvl) {
            this.setDamage(11);
        } else if (3 == lvl) {
            this.setDamage(14);
        } else {
            throw new RuntimeException("CardLevel Error!");
        }
    }

    @Override
    public boolean effect(DuelStatus Sta1, DuelStatus Sta2) {
        if (Sta1.spiritEnough(this.getSpiritNeed())) {
            int hurt = Sta1.attack(Sta2, this.getDamage());
            if (0 < hurt) {
                Sta1.getPlayerBuff().addShield(hurt);
            }
            return true;
        }
        return false;
    }
}
